{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ question.question_text }} | 投票系统</title>
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
</head>
<body>
    <div class="container">
        <div class="card">
            <form action="{% url 'polls:vote' question.id %}" method="post">
                {% csrf_token %}
                <fieldset>
                    <legend><h1>{{ question.question_text }}</h1></legend>
                    
                    {% if error_message %}
                        <p class="error-message">{{ error_message }}</p>
                    {% endif %}
                    
                    <div class="choices">
                        {% for choice in question.choice_set.all %}
                            <div class="choice-item">
                                <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
                                <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label>
                            </div>
                        {% endfor %}
                    </div>
                </fieldset>
                
                <div class="form-actions">
                    <button type="submit" class="btn primary">投票</button>
                    <a href="{% url 'polls:index' %}" class="btn secondary">返回列表</a>
                </div>
            </form>
        </div>
    </div>
</body>
</html>